package com.maybach.core.manager;

import com.maybach.util.query.support.PageResult;
import com.maybach.common.dto.UserInfoDTO;
import com.maybach.common.model.UserDO;
import com.maybach.common.query.UserQuery;
import com.maybach.common.query.ext.UserListQuery;
import com.maybach.core.form.user.UserUpdateStatusForm;

import java.sql.SQLException;
import java.util.List;


/**
 * Manager for User.
 */
public interface UserManager {
    /**
     * query count by query condition.
     */
    int countByQuery(UserQuery query);

    /**
     * delete by query condition.
     */
    int deleteByQuery(UserQuery query);

    /**
     * delete by primary key.
     */
    int deleteByPrimaryKey(UserDO record);

    /**
     * insert selective.
     */
    long insertSelective(UserDO record);

    /**
     * select by query condition.
     */
    List<UserDO> selectByQuery(UserQuery query);


    /**
     * select by query condition with page.
     */
    PageResult<UserDO> selectByQueryWithPage(UserQuery query);

    /**
     * select by primary key.
     */
    UserDO selectByPrimaryKey(Long id);

    /**
     * update by query condition selective.
     */
    int updateByQuerySelective( UserDO record,  UserQuery query);

    /**
     * update by query condition.
     */
    int updateByQuery(UserDO record, UserQuery query);

    /**
     * update by primary key selective.
     */
    int updateByPrimaryKeySelective(UserDO record);

    /**
     * 根据查询条件查询用户列表
     * @param query
     * @return
     */
    List<UserInfoDTO> queryUsersByQuery(UserListQuery query) throws SQLException;

    /**
     * 根据查询条件获取总个数
     * @param query
     * @return
     * @throws SQLException
     */
    Integer countUsersByQuery(UserListQuery query) throws SQLException;

    /**
     *
     * @param form
     * @return
     * @throws SQLException
     */
    int updateUserStatusByForm(UserUpdateStatusForm form) throws SQLException;

    /**
     * 根据用户ID获取商家id
     * @param userId
     * @return
     * @throws SQLException
     */
    Long queryPartnerIdByUserIdDao(Long userId) throws SQLException;

    /**
     * 查询是否存在用户
     * @param userId
     * @return
     * @throws SQLException
     */
    int countUserByUserId(Long userId) throws SQLException;
    
    /**
     * 根据分机号码查询
     * 
     * @param extNo
     * @return
     * @throws SQLException
     */
    UserDO queryByExtNo(String extNo) throws SQLException;
}